image_names=("fang/blog/config-server" "fang/blog/discovery" "fang/blog/user" "fang/blog/api-gateway");

container_names=("fang/blog/config-server" "fang/blog/discovery" "fang/blog/user" "fang/blog/api-gateway");


# delete docker container if exist
for container_name in ${container_names[@]};do
    if docker ps -a | grep -i $container_name; then
        echo "docker rm -f $container_name" ;
        docker rm -f $container_name
    fi
done


#build docker container from iamges



docker run -d -p 9801:8800 -h discovery-eureka-1 --network=blognetwork --name=discovery-eureka-1 fang/blog/discovery

docker run -d -p 9802:8800 -h discovery-eureka-2 --network=blognetwork --name=discovery-eureka-2 fang/blog/discovery

docker run -d -p 9811:8811 -h config-server --network=blognetwork --name=config-server fang/blog/config-server